home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / rc-1.000 / rc-1 / rc-1.5-linux / EXAMPLE-RCRC < prev    next >
Encoding:
Text File  |  1994-07-28  |  4.0 KB  |  96 lines

  1. # Example non-trivial .rcrc, this is the one I use every day.
  2.  
  3. # This first stuff here is kind of a fancy thing for people who wan to
  4. # use rc as a login shell and also want to use ILE.  We run under a pty
  5. # and there are some things that need to be setup that /bin/login will
  6. # cause a little difficulty with.  The only solution I found that works
  7. # consistently is to exec rc twice: once to setup TERMCAP and then again
  8. # this time under ile, to read the rest of this initialization file.
  9.  
  10. if (~ $ILE ()) {         # INVOKE 'ile' ON AN 'rc' IF WE HAVEN'T ALREADY
  11.     ILE=true
  12.     if (~ $TERMCAP ())     # needs to be run before running under a pty
  13.         eval `/usr/X386/bin/resize
  14.     # Any other environment settings that need to be run before being under
  15.     # a pseudo-terminal go before the next line.
  16.     exec ile rc -l
  17. } else
  18.     ILE=()                 # $ILE is just a flag to say to continue or exec
  19.  
  20. # SITE-DEPENDENT INITIALIZATION
  21.  
  22. CDPATH=.:$h:/:/u:/arc:/arc/doc:/arc/doc/Linux:/arc/c:/usr:/usr/local:/usr/src:/usr/doc:/usr/lib:/usr/man:/usr/local/lib:/usr/X386/lib:/usr/X386/lib/X11:/usr/include:/usr/bin
  23. PATH=/lib:/bin:/sbin:/usr/local/bin:/usr/bin:/usr/bin/adm:/usr/bin/arc:/usr/bin/conv:/usr/bin/ispell:/usr/bin/mail:/usr/bin/mh:/usr/bin/net:/usr/bin/pro:/usr/bin/scr:/usr/bin/txt:/usr/TeX/bin:/usr/X386/bin:/usr/openwin/bin:/usr/local/ptybin:/usr/dll/bin
  24. TERM=console
  25. PromptVars=(HOME)                   # For use with VarPrefix in in setprompt
  26. EDITOR=/usr/bin/vi
  27. MANPATH=/usr/man:/usr/man/bsd
  28. SHELL=/bin/rc
  29. MODEM=/dev/modem                    # APPLICATION ENVIRONMENT VARIABLES
  30. GNUTERM=linux                       # Gnuplot default output device
  31. MPAGE='-s -U -I1'                   # postscript mpage default arguments
  32. . $HOME/.F/do                       # define VC version of 'do' function
  33. if (~ $DISPLAY *0*) {               # X-WINDOWS SPECIFICS
  34.     fn do { rxvt -e $* &}           # define X-windows version of 'do' function
  35.     COLOR=-oF                       #   CAN'T GET COLOR-XTERM TO WORK
  36.     setterm -bold -store            #   SO TURN OFF COLOR ls,BOLDING.
  37.     echo -n '?4l'                #   ENABLE JUMP-SCROLL ON rxvt's
  38.     GNUTERM=x11                     #   SET DEFAULT gnuplot TERM TO X11
  39.     OPENWINHOME=/usr/openwin        #   FOR Sun-Style OpenWindows
  40.     PromptVars=($PromptVars OPENWINHOME)
  41.     XDVIFONTS=/usr/local/lib/tex/fonts/cm/%f.%p
  42. }
  43. fn halt {sync; sleep 3s; fasthalt}  # SYSTEM BOOT/HALT
  44. fn reboot { sync; sleep 3s; fastboot}
  45.  
  46. # SITE-INDEPENDENT INITIALIZATION
  47. h=$HOME
  48. history=$h/.history
  49. HOST=`hostname
  50. HOSTTYPE=`arch
  51. PAGER=less
  52. LESS='-M -i -Q -s -c -y5 +Gg'       # +Gg FORCES PIPE INPUT TO BE FULLY READ
  53. limit -h coredumpsize 1000          # Allow reasonably sized core dumps
  54. umask 077                           # DEFAULT MASK SO THAT PERMS ARE rwx------
  55.  
  56. # FUNCTION DEFINITIONS
  57.  
  58. fn prompt { tmp=() {
  59.     tmp=$status
  60.     ~ $tmp 0 || echo '[status ' ^ $tmp ^ ']'
  61. } }
  62.  
  63. # QUICKIE NON-AUTO-LOADED FUNCTIONS
  64. fn .   { ~ $#* 0 && cd ..||builtin . $* }
  65. fn ..  { cd ../.. }
  66. fn ... { cd ../../.. }
  67. fn mv  { builtin mv -i $* }
  68. fn rd  { rmdir $* }
  69. fn ls  { builtin ls $COLOR $* }
  70. fn d   { ls -sX $* }
  71. fn da  { ls -sA $* }
  72. fn ds  { ls -s $* }
  73. fn dS  { ls -sS $* }
  74. fn dl  { ls -lA $* }
  75. fn dx  { ls -X $* }
  76. fn e   { vim $* }
  77. fn x   { exit $* }
  78. fn ps  { builtin ps $* -axOugp }
  79.  
  80. # FUNCTION AUTO-LOADER
  81. TO_AUTO_LOAD=( F Find VarPrefix X c cd cf dirs eg f fg free g gi gu gz gt gzR
  82.                info l m mA mB md mdmv mn push_uniq pwd qcc rdim s0n setprompt
  83.                st tl tm tu tz u ucat ul um up upz uv wh which z zg zm )
  84. # This above list is all of my functions.  Many are just handy aliases, so I'm
  85. # not including this directory in the distribution.  The more complex one's are
  86. # mostly from the FAQ/mailing-list, etc.  I thought this auto-loader was
  87. # general enough to leave here though.
  88.  
  89. builtin cd $HOME/.F             # AUTO-LOAD DIRECTORY IS .F (for Functions)
  90. name=() for (name in $TO_AUTO_LOAD) fn $name {load $0 && $0 $*}
  91. builtin cd $HOME
  92. fn load { builtin . $HOME/.F/$1 }
  93. TO_AUTO_LOAD=()
  94.  
  95. setprompt 
  96.